package com.mrjy.maintain.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mrjy.common.dto.WeUIPickerDto;
import com.mrjy.common.entity.GradeInfo;
import com.mrjy.common.entity.UserInfo;
import com.mrjy.common.util.GlobalConstant;
import com.mrjy.maintain.bo.IGradeInfoBo;

@RequestMapping("/maintain/gradeInfo")
@Controller
public class GradeInfoController {

	@Resource
	private IGradeInfoBo gradeInfoBo;
	
	@RequestMapping("/insert")
	@ResponseBody
	public Object insert(GradeInfo gradeInfo, HttpSession session) {
		return gradeInfoBo.txInsert(gradeInfo);
	}

	@RequestMapping("/deleteByIds")
	@ResponseBody
	public Object deleteByIds(int[] ids) {		
		return gradeInfoBo.txDeleteByIds(ids);
	}
	
	@RequestMapping("/updateDisableFlag")
	@ResponseBody
	public Object updateDisableFlag(GradeInfo gradeInfo) {		
		return gradeInfoBo.updateDisableFlag(gradeInfo);
	}
		
	@RequestMapping("/updateById")
	@ResponseBody
	public Object updateById(GradeInfo gradeInfo) {
		return gradeInfoBo.txUpdateById(gradeInfo);
	}
	
	@RequestMapping("/queryById")
	@ResponseBody
	public Object queryById(int id) {
		return gradeInfoBo.queryById(id);
	}
	
	@RequestMapping("/queryList")
	@ResponseBody
	public Object queryList(GradeInfo gradeInfo){
		return gradeInfoBo.queryList(gradeInfo);
	}
		
	@RequestMapping("/queryPage")
	@ResponseBody
	public Object queryPage(GradeInfo gradeInfo) {
		return gradeInfoBo.queryPage(gradeInfo);
	}
		
	@RequestMapping("/getAllGrade")
	@ResponseBody
	public Object getAllGrade(GradeInfo gradeInfo){
		return gradeInfoBo.queryList(gradeInfo);
	}
	
	@RequestMapping("/queryListByUserMember")
	@ResponseBody
	public Object queryListByUserMember(HttpSession session){
		UserInfo userInfo = (UserInfo) session.getAttribute(GlobalConstant.USER_INFO);
		return gradeInfoBo.queryListByUserMember(userInfo != null ? userInfo.getId() : null);
	}
	
	
	@RequestMapping("/queryListForWeUIPicker")
	@ResponseBody
	public Object queryListForWeUIPicker(HttpSession session){
		
		return gradeInfoBo.queryListForWeUIPicker();
	}
	
}
